# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: xrs <xrs@mail36.net>
pkgname=gnurl
pkgver=7.72.0
pkgrel=0
pkgdesc="A micro fork of libcurl"
url="https://gnunet.org/en/gnurl.html"
arch="all"
license="MIT"
depends="ca-certificates"
depends_dev="gnutls-dev libidn2-dev zlib-dev"
checkdepends="python3"
makedepends="$depends_dev perl"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc"
source="https://mirror.kumi.systems/gnu/gnunet/gnurl-$pkgver.tar.gz
	skip-missing-tests.patch
	"

# secfixes:
#   7.66.0-r0:
#     - CVE-2019-5482
#     - CVE-2019-5481
#   7.65.0-r0:
#     - CVE-2019-5436

build() {
	# Note: The second group of options is based on
	# http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/www/gnurl/Makefile?rev=1.9&content-type=text/x-cvsweb-markup.
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--enable-ipv6 \
		--enable-static \
		--enable-unix-sockets \
		--with-ca-path=/etc/ssl/certs \
		--with-ca-bundle=/etc/ssl/certs/ca-certificates.crt \
		--with-pic \
		\
		--without-libssh2 \
		--without-libmetalink \
		--without-winidn \
		--without-librtmp \
		--without-nghttp2 \
		--without-nss \
		--without-cyassl \
		--without-ssl \
		--without-winssl \
		--without-darwinssl \
		--disable-sspi \
		--disable-ldap \
		--without-libpsl \
		--disable-rtsp \
		--disable-dict \
		--disable-telnet \
		--disable-tftp \
		--disable-pop3 \
		--disable-imap \
		--disable-smtp \
		--disable-gopher \
		--disable-file \
		--disable-ftp \
		--disable-smb \
		--disable-ntlm-wb \
		--with-gnutls \
		--with-libidn2 \
		--with-libz \
		--without-ca-fallback \
		--without-gssapi \
		--disable-valgrind \
		--without-ngtcp2 \
		--without-nghttp2 \
		--without-nghttp3 \
		--without-quiche
	make
}

check() {
	make TFLAGS="!971" check
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
7dc28b5647d85f9e9c5b71c3b80f73572bf162e5c093ff8c407c1c2765a9ac839fcb8a0d6ff38c6f7ec0bbb0104137bfc39e4af0a48a593b845a61b22d108234  gnurl-7.72.0.tar.gz
1c96b7ef7c94d37814e578e642273ebad0411b93298793dcf5754c8f8701fe1477830dfe8d9d4cc39ad940f410d0a3981db3540e4976a039ac4f35c36000b302  skip-missing-tests.patch
"
